const path = require('path')
const webpack = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const CopyWebpackPlugin = require('copy-webpack-plugin')
// const mapjson = require('src/views/dp/firstdp/map/chinamaincity')
function resolve(dir) {
  return path.join(__dirname, dir)
}
// vue.config.js
module.exports = {

  outputDir: 'security-monitor-yy', // 生成打包文件名
  publicPath: "/securit-monitor/", //前端访问项目名
  publicPath: "./",
  configureWebpack: {
    plugins: [
      // Ignore all locale files of moment.js
      new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
      // new BundleAnalyzerPlugin(),
      new CopyWebpackPlugin([{
        from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml'
      },
      {
        from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf'
      },
      {
        from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js',
        to: 'js/'
      }
      ])
    ],
    // externals: {
    //   'vue': 'Vue',
    //   'ant-design-vue': 'antd',
    //   'BMap': 'BMap'
    // }
  },
  devServer: {
    https: false,
    disableHostCheck: true,
    proxy: {
      '/apiUrl': {
        target: 'http://115.236.28.75:19090/apiUrl/', // 线上地址
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/apiUrl': ''
        }
      },
      '/ddkj': {
        target: 'http://115.236.28.77:10000', // 线上地址
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/ddkj': '' //重写
        }
      },
      '/sms': {
        target: 'http://115.236.28.77:10000', // 线上地址
        ws: true,
        changeOrigin: true,
        // 不重写
      },
    },
    open: true,
    port: 8095,
  },
}